package com.wenwan.manage.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.wenwan.manage.service.GoodsCategorySecondService;

import javax.annotation.Resource;

/**
 * 商品二级类目
 * 
 * @author Admin
 *
 */
@Controller
@RequestMapping(value = "/goods/category/second")
public class GoodsCategorySecondController {

	@Autowired
	private GoodsCategorySecondService goodsCategorySecondService;

	@ResponseBody
	@RequestMapping(value = "create", method = { RequestMethod.POST })
	public Map<String,Object> create(@RequestParam(required = true) String name,
			@RequestParam(required = true) String goodsCategoryFirstId) {
		return goodsCategorySecondService.create(name, goodsCategoryFirstId);
	}

	@ResponseBody
	@RequestMapping(value = "update", method = { RequestMethod.POST })
	public Map<String,Object> update(@RequestParam(required = true) String id,
			@RequestParam(required = false) String name, @RequestParam(required = false) String goodsCategoryFirstId) {
		return goodsCategorySecondService.update(id, name, goodsCategoryFirstId);
	}

	@ResponseBody
	@RequestMapping(value = "delete/by/id", method = { RequestMethod.POST })
	public Map<String,Object> deleteById(@RequestParam(required = true) String id) {
		return goodsCategorySecondService.deleteById(id);
	}

}
